create table [Partner]
(
	 [PartnerId] int identity(1, 1) primary key
	,[Logo] nvarchar(128)
	,[PartnerName] nvarchar(128)
	,[PartnerSortName] nvarchar(128)
	,[PartnerEnglishName] nvarchar(128)
	,[Phone] varchar(32)
	,[Telephone] varchar(32)
	,[Hotline] varchar(32)
	,[Fax] varchar(32)
	,[Email] nvarchar(128)
	,[Represent] nvarchar(128)
	,[Regency] nvarchar(128)
	,[ContinentId] int
	,[NationalId] int
	,[CityId] int
	,[DistrictId] int
	,[WardId] int
	,[Address] nvarchar(256)
	,[CreatedBy] int
	,[CreatedDate] datetime
	,[UpdatedBy] int
	,[UpdatedDate] datetime
	,[Status] int
)
go

ALTER PROCEDURE PartnerGet
	@PartnerId int
AS
SELECT *
FROM [Partner]
WHERE [Partner].[PartnerId] = @PartnerId
GO

ALTER PROCEDURE PartnerList
AS
SELECT *
FROM [Partner]
ORDER BY [PartnerId] DESC
GO

ALTER PROCEDURE PartnerInsert
	@Logo nvarchar(128)
	,@PartnerName nvarchar(128)
	,@PartnerSortName nvarchar(128)
	,@PartnerEnglishName nvarchar(128)
	,@Phone varchar(32)
	,@Telephone varchar(32)
	,@Hotline varchar(32)
	,@Fax varchar(32)
	,@Email nvarchar(128)
	,@Represent nvarchar(128)
	,@Regency nvarchar(128)
	,@ContinentId int
	,@NationalId int
	,@CityId int
	,@DistrictId int
	,@WardId int
	,@Address nvarchar(256)
	,@CreatedBy int
	,@CreatedDate datetime
	,@UpdatedBy int
	,@UpdatedDate datetime
	,@Status int
AS

INSERT INTO Partner (
	 [Logo]
	,[PartnerName]
	,[PartnerSortName]
	,[PartnerEnglishName]
	,[Phone]
	,[Telephone]
	,[Hotline]
	,[Fax]
	,[Email]
	,[Represent]
	,[Regency]
	,[ContinentId]
	,[NationalId]
	,[CityId]
	,[DistrictId]
	,[WardId]
	,[Address]
	,[CreatedBy]
	,[CreatedDate]
	,[UpdatedBy]
	,[UpdatedDate]
	,[Status]
	
) VALUES (
	 @Logo
	,@PartnerName
	,@PartnerSortName
	,@PartnerEnglishName
	,@Phone
	,@Telephone
	,@Hotline
	,@Fax
	,@Email
	,@Represent
	,@Regency
	,@ContinentId
	,@NationalId
	,@CityId
	,@DistrictId
	,@WardId
	,@Address
	,@CreatedBy
	,@CreatedDate
	,@UpdatedBy
	,@UpdatedDate
	,@Status
	
)

select SCOPE_IDENTITY()
GO

ALTER PROCEDURE PartnerUpdate
	@PartnerId int, 
	@Logo nvarchar(128), 
	@PartnerName nvarchar(128), 
	@PartnerSortName nvarchar(128), 
	@PartnerEnglishName nvarchar(128), 
	@Phone varchar(32), 
	@Telephone varchar(32), 
	@Hotline varchar(32), 
	@Fax varchar(32), 
	@Email nvarchar(128), 
	@Represent nvarchar(128), 
	@Regency nvarchar(128), 
	@ContinentId int, 
	@NationalId int, 
	@CityId int, 
	@DistrictId int, 
	@WardId int, 
	@Address nvarchar(256), 
	@CreatedBy int, 
	@CreatedDate datetime, 
	@UpdatedBy int, 
	@UpdatedDate datetime, 
	@Status int 
AS
UPDATE Partner SET
	    [Logo] = @Logo
	   ,[PartnerName] = @PartnerName
	   ,[PartnerSortName] = @PartnerSortName
	   ,[PartnerEnglishName] = @PartnerEnglishName
	   ,[Phone] = @Phone
	   ,[Telephone] = @Telephone
	   ,[Hotline] = @Hotline
	   ,[Fax] = @Fax
	   ,[Email] = @Email
	   ,[Represent] = @Represent
	   ,[Regency] = @Regency
	   ,[ContinentId] = @ContinentId
	   ,[NationalId] = @NationalId
	   ,[CityId] = @CityId
	   ,[DistrictId] = @DistrictId
	   ,[WardId] = @WardId
	   ,[Address] = @Address
	   ,[CreatedBy] = @CreatedBy
	   ,[CreatedDate] = @CreatedDate
	   ,[UpdatedBy] = @UpdatedBy
	   ,[UpdatedDate] = @UpdatedDate
	   ,[Status] = @Status
WHERE [Partner].[PartnerId] = @PartnerId
GO

ALTER PROCEDURE PartnerDelete
	@PartnerId int
AS
DELETE FROM Partner
WHERE [Partner].[PartnerId] = @PartnerId
GO